var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabs: ['全部', '待确认', '已确认'],
    tabIndex: 0,
    list: [],
    is_que: 0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;
    var shop_id = options.shop_id;
    this.setData({
      shop_id: shop_id
    })
    wx.showLoading({
      title: '加载中…',
    })
    app.ihttpGet('https://www.58zltc.com/api.php/Shop/getShopYuyue/shop_id/' + shop_id, function (res) {
      console.log(res.data)
      that.setData({
        list: res.data
      })
    })
  },

  setTab: function(e){
    this.setData({
      tabIndex: e.currentTarget.dataset.index
    })
  },

  backto: function () {
    wx.navigateBack({
      
    })
  },
  confirm: function (e) {
    let that = this;
    wx.showLoading({
      title: '确认中..',
    })
    app.ihttpGet('https://www.58zltc.com/api.php/Shop/confirmYuyue/id/' + e.currentTarget.dataset.id, function (res) {
      wx.showToast({
        title: res.data.msg,
        icon: 'none'
      })
      var dataOn = { shop_id: that.data.shop_id}
      that.setData({
        is_que: 1
      })
      setTimeout(function(){
        that.onLoad(dataOn);
      },1500)
    
      
    })
  }
})